import 'package:flutter/material.dart';

class CalcPage extends StatefulWidget{
  const CalcPage({super.key});


  @override
  State<CalcPage> createState() => calcState();
}

class calcState extends State<CalcPage>{
  String input = "";
  var keys = [1,2,3,4,5,6,7,8,9,0];

  @override
  Widget build(BuildContext context) {
      keys.shuffle();
      return Column(
          children: [
            InputChip(
              label: Text(input)
            ),
            InputKeyboard(keys)
          ],
        );
  }
 }
    class InputKeyboard extends StatelessWidget{
      List<int> keys=[];
      InputKeyboard(keys, {super.key}){
        this.keys = keys;
      }
      buttonRow(start,[int len = 3]){
          var rt=[];
          keys.sublist(start,start+len).forEach((v){
              rt.add(InputKeyboardButton(v.toString()));
          });
          return rt;
      }

      @override
      Widget build(BuildContext context) {
        
        return Column(
          children: [
            Row(children: buttonRow(0,3)),
            Row(children: buttonRow(3,3)),
            Row(children: buttonRow(6,3)),
            Row(children: [
              InputKeyboardButton(keys[9].toString()),
              // InputKeyboardButton(text:"←",background:"red"),
              // InputKeyboardButton(text:"c",background:"red"),
            ],)
          ],
        );
      }
    }

// ignore: must_be_immutable
class InputKeyboardButton extends TextButton{
  String text="";
  InputKeyboardButton(text,[onPressed]):super(onPressed: onPressed, child:Text(text));
  // InputKeyboardButton(String test,{}){
  //     {
  //   super.key, 
  //   super.child = Text(text: text),
  //   super.onPressed
  //   }
  // }

}